<!-- saved from url=(0014)about:internet -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>ShoppingCartBase.as</title>
<link rel="stylesheet" type="text/css" href="../../../../../SourceStyles.css"/>
</head>

<body><pre><span class="ActionScriptpackage">package</span> <span class="ActionScriptDefault_Text">com</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">flowersinc</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">shop</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">views</span>
<span class="ActionScriptBracket/Brace">{</span>
    <span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">com</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">flowersinc</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">shop</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">model</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">Flower</span>;
    
    <span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">flash</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">events</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">Event</span>;
    
    <span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">mx</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">collections</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">ArrayCollection</span>;
    <span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">mx</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">containers</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">Canvas</span>;
    <span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">mx</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">controls</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">DataGrid</span>;
    <span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">mx</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">controls</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">Image</span>;
    <span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">mx</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">events</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">DragEvent</span>;
    <span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">mx</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">managers</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">DragManager</span>;

    <span class="ActionScriptReserved">public</span> <span class="ActionScriptclass">class</span> <span class="ActionScriptDefault_Text">ShoppingCartBase</span> <span class="ActionScriptReserved">extends</span> <span class="ActionScriptDefault_Text">Canvas</span>
    <span class="ActionScriptBracket/Brace">{</span>
        
        <span class="ActionScriptBracket/Brace">[</span><span class="ActionScriptMetadata">Bindable</span><span class="ActionScriptBracket/Brace">]</span><span class="ActionScriptReserved">public</span> <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">customerDataGrid</span> : <span class="ActionScriptDefault_Text">DataGrid</span>;
        <span class="ActionScriptReserved">public</span> <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">flowers</span> : <span class="ActionScriptDefault_Text">ArrayCollection</span>;
        
        <span class="ActionScriptBracket/Brace">[</span><span class="ActionScriptMetadata">Bindable</span><span class="ActionScriptBracket/Brace">]</span><span class="ActionScriptReserved">protected</span> <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">flowersCount</span> : <span class="ActionScriptDefault_Text">Number</span> <span class="ActionScriptOperator">=</span> 0;
        
        <span class="ActionScriptBracket/Brace">[</span><span class="ActionScriptMetadata">Bindable</span><span class="ActionScriptBracket/Brace">]</span><span class="ActionScriptReserved">protected</span> <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">orders</span> : <span class="ActionScriptDefault_Text">ArrayCollection</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">ArrayCollection</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptBracket/Brace">)</span>;
        
        
        <span class="ActionScriptBracket/Brace">[</span><span class="ActionScriptMetadata">Bindable</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">"flowerAdded"</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptBracket/Brace">]</span> 
        <span class="ActionScriptBracket/Brace">[</span><span class="ActionScriptMetadata">Bindable</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">"flowerRemoved"</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptBracket/Brace">]</span>
        <span class="ActionScriptReserved">protected</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptReserved">get</span> <span class="ActionScriptDefault_Text">price</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptBracket/Brace">)</span> : <span class="ActionScriptDefault_Text">Number</span> 
        <span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">totalPrice</span> : <span class="ActionScriptDefault_Text">Number</span> <span class="ActionScriptOperator">=</span> 0;
            
            <span class="ActionScriptReserved">for each</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">flower</span> : <span class="ActionScriptDefault_Text">Flower</span> <span class="ActionScriptReserved">in</span> <span class="ActionScriptDefault_Text">orders</span><span class="ActionScriptBracket/Brace">)</span> 
            <span class="ActionScriptBracket/Brace">{</span>    
                <span class="ActionScriptDefault_Text">totalPrice</span> <span class="ActionScriptOperator">+=</span> <span class="ActionScriptDefault_Text">flower</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">amount</span> <span class="ActionScriptOperator">*</span> <span class="ActionScriptDefault_Text">flower</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">price</span>;
            <span class="ActionScriptBracket/Brace">}</span>    
            
            <span class="ActionScriptReserved">return</span> <span class="ActionScriptDefault_Text">totalPrice</span>;
        <span class="ActionScriptBracket/Brace">}</span>
        
        <span class="ActionScriptReserved">public</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">addToCart</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">flower</span>:<span class="ActionScriptDefault_Text">Flower</span><span class="ActionScriptBracket/Brace">)</span>:<span class="ActionScriptReserved">void</span>
        <span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptDefault_Text">flowersCount</span> <span class="ActionScriptOperator">+=</span> 1;
            
            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">foundFlower</span> : <span class="ActionScriptDefault_Text">Boolean</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">false</span>;
            
            <span class="ActionScriptReserved">for each</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">item</span> : <span class="ActionScriptDefault_Text">Flower</span> <span class="ActionScriptReserved">in</span> <span class="ActionScriptDefault_Text">orders</span><span class="ActionScriptBracket/Brace">)</span> 
            <span class="ActionScriptBracket/Brace">{</span>
                <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">Flower</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">flower</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">name</span> <span class="ActionScriptOperator">==</span> <span class="ActionScriptDefault_Text">item</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">name</span><span class="ActionScriptBracket/Brace">)</span> 
                <span class="ActionScriptBracket/Brace">{</span>
                    <span class="ActionScriptDefault_Text">foundFlower</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">true</span>;
                    <span class="ActionScriptDefault_Text">item</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">amount</span> <span class="ActionScriptOperator">+=</span> 1;
                    <span class="ActionScriptDefault_Text">flower</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">amount</span> <span class="ActionScriptOperator">-=</span> 1;
                <span class="ActionScriptBracket/Brace">}</span>
            <span class="ActionScriptBracket/Brace">}</span>
            
            <span class="ActionScriptDefault_Text">flower</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">canOrder</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">flower</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">amount</span> <span class="ActionScriptOperator">&gt;</span> 0<span class="ActionScriptBracket/Brace">)</span>;         
            
            <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">foundFlower</span> <span class="ActionScriptOperator">==</span> <span class="ActionScriptReserved">false</span><span class="ActionScriptBracket/Brace">)</span> 
            <span class="ActionScriptBracket/Brace">{</span>
                <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">orderedFlowerInstance</span> : <span class="ActionScriptDefault_Text">Flower</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">Flower</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptBracket/Brace">)</span>;
                <span class="ActionScriptDefault_Text">orderedFlowerInstance</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">name</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">flower</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">name</span>;
                <span class="ActionScriptDefault_Text">orderedFlowerInstance</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">addEventListener</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">"itemDeleted"</span><span class="ActionScriptOperator">,</span> <span class="ActionScriptDefault_Text">onItemDeleted</span><span class="ActionScriptBracket/Brace">)</span>;        
                <span class="ActionScriptDefault_Text">orderedFlowerInstance</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">amount</span> <span class="ActionScriptOperator">=</span> 1;
                <span class="ActionScriptDefault_Text">orderedFlowerInstance</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">price</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">flower</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">price</span>;
                <span class="ActionScriptDefault_Text">flower</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">amount</span> <span class="ActionScriptOperator">-=</span> 1;
                    
                <span class="ActionScriptDefault_Text">orders</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">addItem</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">orderedFlowerInstance</span><span class="ActionScriptBracket/Brace">)</span>;
                
                <span class="ActionScriptReserved">for</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">i</span> : <span class="ActionScriptDefault_Text">int</span> <span class="ActionScriptOperator">=</span> 0; <span class="ActionScriptDefault_Text">i</span> <span class="ActionScriptOperator">&lt;</span> <span class="ActionScriptDefault_Text">orders</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">length</span>; <span class="ActionScriptDefault_Text">i</span><span class="ActionScriptOperator">++</span><span class="ActionScriptBracket/Brace">)</span> 
                <span class="ActionScriptBracket/Brace">{</span>
                    <span class="ActionScriptDefault_Text">Flower</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">orders</span><span class="ActionScriptBracket/Brace">[</span><span class="ActionScriptDefault_Text">i</span><span class="ActionScriptBracket/Brace">]</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">number</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">i</span> <span class="ActionScriptOperator">+</span> 1; 
                <span class="ActionScriptBracket/Brace">}</span>
            <span class="ActionScriptBracket/Brace">}</span>
            
            <span class="ActionScriptDefault_Text">dispatchEvent</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">Event</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">"flowerAdded"</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptBracket/Brace">)</span>;
        <span class="ActionScriptBracket/Brace">}</span>
    
        <span class="ActionScriptReserved">protected</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">onCartButtonClick</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptBracket/Brace">)</span> : <span class="ActionScriptReserved">void</span> 
        <span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">currentState</span> <span class="ActionScriptOperator">==</span> <span class="ActionScriptReserved">null</span><span class="ActionScriptBracket/Brace">)</span> 
            <span class="ActionScriptBracket/Brace">{</span>
                <span class="ActionScriptDefault_Text">currentState</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptString">"HideDetails"</span>;
            <span class="ActionScriptBracket/Brace">}</span>
            <span class="ActionScriptReserved">else</span> 
            <span class="ActionScriptBracket/Brace">{</span>
                <span class="ActionScriptDefault_Text">currentState</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">null</span>;
            <span class="ActionScriptBracket/Brace">}</span>
        <span class="ActionScriptBracket/Brace">}</span>
        
        <span class="ActionScriptReserved">protected</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">onDragEnter</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">event</span>:<span class="ActionScriptDefault_Text">DragEvent</span><span class="ActionScriptBracket/Brace">)</span>:<span class="ActionScriptReserved">void</span>
        <span class="ActionScriptBracket/Brace">{</span>    
            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">flower</span> : <span class="ActionScriptDefault_Text">Flower</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">event</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">dragSource</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">dataForFormat</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">'flower'</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptReserved">as</span> <span class="ActionScriptDefault_Text">Flower</span>;
            
            <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">flower</span> <span class="ActionScriptOperator">!==</span> <span class="ActionScriptReserved">null</span><span class="ActionScriptBracket/Brace">)</span>
                <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">dropTarget</span> : <span class="ActionScriptDefault_Text">DataGrid</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">event</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">currentTarget</span> <span class="ActionScriptReserved">as</span> <span class="ActionScriptDefault_Text">DataGrid</span>;
                <span class="ActionScriptDefault_Text">DragManager</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">acceptDragDrop</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">dropTarget</span><span class="ActionScriptBracket/Brace">)</span>;
        <span class="ActionScriptBracket/Brace">}</span>
        
        <span class="ActionScriptReserved">protected</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">onDragDrop</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">event</span>:<span class="ActionScriptDefault_Text">DragEvent</span><span class="ActionScriptBracket/Brace">)</span>:<span class="ActionScriptReserved">void</span>
        <span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">flower</span> : <span class="ActionScriptDefault_Text">Flower</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">event</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">dragSource</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">dataForFormat</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">'flower'</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptReserved">as</span> <span class="ActionScriptDefault_Text">Flower</span>;
            <span class="ActionScriptDefault_Text">addToCart</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">flower</span><span class="ActionScriptBracket/Brace">)</span>;
        <span class="ActionScriptBracket/Brace">}</span>
            
        
        <span class="ActionScriptReserved">private</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">onItemDeleted</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">event</span> : <span class="ActionScriptDefault_Text">Event</span><span class="ActionScriptBracket/Brace">)</span> : <span class="ActionScriptReserved">void</span> 
        <span class="ActionScriptBracket/Brace">{</span>    
            <span class="ActionScriptReserved">for each</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">item</span> : <span class="ActionScriptDefault_Text">Flower</span> <span class="ActionScriptReserved">in</span> <span class="ActionScriptDefault_Text">flowers</span><span class="ActionScriptBracket/Brace">)</span> 
            <span class="ActionScriptBracket/Brace">{</span>
                <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">Flower</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">event</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">target</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">name</span> <span class="ActionScriptOperator">==</span> <span class="ActionScriptDefault_Text">item</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">name</span><span class="ActionScriptBracket/Brace">)</span> 
                <span class="ActionScriptBracket/Brace">{</span>
                    <span class="ActionScriptDefault_Text">item</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">amount</span> <span class="ActionScriptOperator">+=</span> 1;
                    <span class="ActionScriptDefault_Text">event</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">target</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">amount</span> <span class="ActionScriptOperator">-=</span> 1;
                    <span class="ActionScriptReserved">break</span>;
                <span class="ActionScriptBracket/Brace">}</span>
            <span class="ActionScriptBracket/Brace">}</span>
            
            <span class="ActionScriptDefault_Text">item</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">canOrder</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">item</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">amount</span> <span class="ActionScriptOperator">&gt;</span> 0<span class="ActionScriptBracket/Brace">)</span>;
            
            <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">event</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">target</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">amount</span> <span class="ActionScriptOperator">==</span> 0<span class="ActionScriptBracket/Brace">)</span> 
            <span class="ActionScriptBracket/Brace">{</span> 
                <span class="ActionScriptDefault_Text">orders</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">removeItemAt</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">orders</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">getItemIndex</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">customerDataGrid</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">selectedItem</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptBracket/Brace">)</span>; 
            <span class="ActionScriptBracket/Brace">}</span>
            
            <span class="ActionScriptReserved">for</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">i</span> : <span class="ActionScriptDefault_Text">int</span> <span class="ActionScriptOperator">=</span> 0; <span class="ActionScriptDefault_Text">i</span> <span class="ActionScriptOperator">&lt;</span> <span class="ActionScriptDefault_Text">orders</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">length</span>; <span class="ActionScriptDefault_Text">i</span><span class="ActionScriptOperator">++</span><span class="ActionScriptBracket/Brace">)</span> 
            <span class="ActionScriptBracket/Brace">{</span>
                <span class="ActionScriptDefault_Text">Flower</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">orders</span><span class="ActionScriptBracket/Brace">[</span><span class="ActionScriptDefault_Text">i</span><span class="ActionScriptBracket/Brace">]</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">number</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">i</span> <span class="ActionScriptOperator">+</span> 1; 
            <span class="ActionScriptBracket/Brace">}</span>
            
            <span class="ActionScriptDefault_Text">flowersCount</span> <span class="ActionScriptOperator">-=</span> 1;
            
            <span class="ActionScriptDefault_Text">dispatchEvent</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">Event</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">"flowerRemoved"</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptBracket/Brace">)</span>;
        <span class="ActionScriptBracket/Brace">}</span>
    <span class="ActionScriptBracket/Brace">}</span>
<span class="ActionScriptBracket/Brace">}</span></pre></body>
</html>
